//
//  JSNetworking.h
//  JigSaw
//
//  Created by Slim Wang on 15/3/11.
//  Copyright (c) 2015年 LITB. All rights reserved.
//

#import <Foundation/Foundation.h>

@class JSHttpRequest;
@class RACSignal;

@protocol VSHttpNetworkingDelegate <NSObject>

@optional

- (void)willSendRequest:(NSString *)URLString;

- (void)didReceiveResponse;

@end

@interface JSNetworking : NSObject

MACRO_SHARED_INSTANCE_INTERFACE;

@property (nonatomic, weak) id<VSHttpNetworkingDelegate> delegate;

- (RACSignal *)rac_signalForHttpGET:(JSHttpRequest *)request;

- (RACSignal *)rac_signalForHttpPOST:(JSHttpRequest *)request;

// TODO This method should be refactored.
- (RACSignal *)rac_signalForHttpPOSTWithoutJson:(NSString *)URLString
                                     parameters:(NSDictionary *)parameters;

- (RACSignal *)rac_signalForHttpPOST:(JSHttpRequest *)request
                            filePath:(NSURL *)filePath
                                name:(NSString *)name
                            fileName:(NSString *)fileName
                            mimeType:(NSString *)mimeType;

- (RACSignal *)rac_signalForHttpPOST:(JSHttpRequest *)request
                            fileData:(NSData *)fileData
                                name:(NSString *)name
                            fileName:(NSString *)fileName
                            mimeType:(NSString *)mimeType;

@end
